package com.dkm.orproject.dkmoa.service.serviceimpl;

import com.dkm.orproject.dkmoa.dao.OaDeliverFromGodownMapper;
import com.dkm.orproject.dkmoa.domain.OaDeliverFromGodown;
import com.dkm.orproject.dkmoa.domain.vo.OaDeliverFromGodownVo;
import com.dkm.orproject.dkmoa.service.OaDeliverFromGodownService;
import com.dkm.orproject.utils.utils.IdToobtainUtils;
import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 *  @ClassName : OaDeliverFromGodownServiceImpl  //类名
 *  @Description : 资产实现类service   //描述
 *  @Author : 石智诚  //作者
 *  @Date: 2020-11-30 16:09  //时间
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class OaDeliverFromGodownServiceImpl implements OaDeliverFromGodownService {
    /**
     * 资产实现Mapper
     */
    @Resource
    OaDeliverFromGodownMapper deliverFromGodownMapper;
    /**
     * 雪花算法
     */
    @Resource
    IdToobtainUtils utils;
    @Override
    public int deleteByPrimaryKey(Long pkDeliverFromGodownId) {
        return deliverFromGodownMapper.deleteByPrimaryKey(pkDeliverFromGodownId);
    }

    @Override
    public int insert(OaDeliverFromGodown record) {
        record.setPkDeliverFromGodownId(utils.getNumberId());
        record.setIsRevision("1");
        return deliverFromGodownMapper.insertSelective(record);
    }

    @Override
    public OaDeliverFromGodown selectByPrimaryKey(Long pkDeliverFromGodownId) {
        return deliverFromGodownMapper.selectByPrimaryKey(pkDeliverFromGodownId);
    }

    @Override
    public int updateByPrimaryKeySelective(OaDeliverFromGodown record) {
        return deliverFromGodownMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public List<OaDeliverFromGodownVo> findAll(OaDeliverFromGodownVo deliverFromGodownVo, String startDate, String endDate, Integer page, Integer limit) {
        PageHelper.startPage(page, limit);
        return deliverFromGodownMapper.findAll(deliverFromGodownVo, startDate, endDate);
    }


    @Override
    public Long rowCount(OaDeliverFromGodownVo deliverFromGodownVo, String startDate, String endDate) {
        return deliverFromGodownMapper.rowCount(deliverFromGodownVo, startDate, endDate);
    }

    @Override
    public int deleteByAll(List<Long> pkDeliverFromGodownId) {
        return deliverFromGodownMapper.deleteByAll(pkDeliverFromGodownId);
    }

}
